const { expressjwt: jwt } = require('express-jwt')

const secret = 'diaoqi'

// 验证token过期
const jwtAuth = jwt({
    secret, // 密钥
    algorithms: ['HS256'], // 签名算法
}).unless({
    path: ['/api/login', '/api/register', /^\/images\/.*/, /^\/statics\/.*/], // unless 设置jwt认证白名单
})


module.exports = { jwtAuth }
